<?php
$LatestUsers = "SELECT userID,username FROM b_users WHERE validated='1' ORDER BY userID DESC LIMIT 3"; 
$LatestUsers2 = mysql_query($LatestUsers, $forum) or die("Error #01: getting latest". mysql_error());
echo "<center>Newest members ";
while ($LatestUsers3 = mysql_fetch_array($LatestUsers2) )
{
	echo "<a href='forum/profile.php?userID=$LatestUsers3[0]'><strong>$LatestUsers3[1]</strong></a> &middot;&nbsp;";
}
$avalue = "SELECT MAX(id) AS ID FROM b_vote";
$avalue2 = mysql_query($avalue, $forum) or die("Error #02: ".mysql_error());
$avalue3= mysql_fetch_array($avalue2);

$users1 = "SELECT COUNT(*) AS usercount FROM b_users where username!='Guest'";
$users2 = mysql_query($users1, $forum) or die("Error #03: " . mysql_error());
$usercount = mysql_result($users2, 0); 

$count1 = "SELECT COUNT(*) AS postcount FROM b_posts";
$count2 = mysql_query($count1, $forum) or die("Error #04: " . mysql_error()); 
$postcount = mysql_result($count2, 0); 

echo "Total posts <strong>$postcount</strong> &middot; Total accounts <strong>$usercount</strong><br>";
 
$chars = "SELECT COUNT(*) AS charcount FROM characters";
$chars2 = mysql_query($chars, $char) or die("Error #05: " . mysql_error());
$charcount = mysql_result($chars2, 0); 

echo "&middot;&nbsp;Total characters <strong>$charcount</strong>&nbsp;&middot;&nbsp;";
echo "Players has voted <strong>$avalue3[id]</strong> times&nbsp;&middot;<br>";

$LatestChars = "SELECT name,race,gender from characters order by guid DESC limit 5"; 
$LatestChars2 = mysql_query($LatestChars, $char) or die("Error #06: " . mysql_error());

echo "&middot; Newest characters ";
while ($LatestChars3 = mysql_fetch_array($LatestChars2) ){
	echo "<img src='forum/images/race/$LatestChars3[1]-$LatestChars3[2].gif' height='12px'/> <strong>$LatestChars[0]</strong></a> &middot;&nbsp;";
}	  
echo "</center>";
?>